package org.example.clouddemo.service.common.mapper;

import org.apache.ibatis.annotations.Select;
import org.example.clouddemo.bean.common.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
* <p>
* 用户表 Mapper 接口
* </p>
*
* @author hzg
* @since 2025-06-06
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {
    // 根据用户名查询用户
    @Select("SELECT * FROM user WHERE username = #{username}")
    User findByUsername(String username);

    // 根据ID查询用户
    @Select("SELECT id, username, nickname, email FROM user WHERE id = #{id}")
    User findById(Long id);
}
